package WaiBao;

import java.util.Arrays;

public class WangYiTing {
    public static void main(String[] args) {
        String[] name = {"李娜(班长)", "李中申(团支书)", "小李(学习委员)", "张继科(体育委员)", "何晨光", "李慧(宣传委员)", "李南星", "李茂", "李嘉欣", "李玟", "李丽珍", "王子鸣",
                "李丹阳", "李玲玉", "李双江", "筷子兄弟", "李灿生", "王思懿", "王珞丹", "王菲", "刘德义", "周星驰", "周志平", "林一莲", "凌风", "张正", "刘准", "张曼玉",
                "林心如", "王依婷(组织委员)"};//备注：考生本人:王依婷(组织委员)
        int[] age = {21, 19, 20, 18, 18, 21, 22, 18, 18, 19, 21, 19, 19, 20, 21, 19, 18, 19, 18, 20, 19, 19, 20, 20, 20, 18, 22, 18, 20, 20};//考生年龄：20

        double[] qingjie1 = {80, 74, 59, 85, 74, 68, 71, 80, 68, 80, 90, 74, 85, 79, 64, 68, 69, 89, 96, 80, 92, 91, 90, 89, 75, 74, 74, 85, 88, 96};
        double[] qingjie2 = {67, 84, 80, 86, 76, 86, 74, 83, 69, 74, 94, 67, 84, 75, 90, 65, 86, 79, 66, 78, 80, 74, 85, 87, 74, 80, 77, 70, 89, 96};
        double[] qingjie3 = {84, 83, 99, 74, 85, 75, 63, 69, 80, 69, 73, 87, 85, 85, 65, 98, 89, 69, 96, 63, 92, 81, 95, 85, 76, 88, 73, 78, 84, 96};

        double yiqi1;//代表每个学生的总分
        double yiqi2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            yiqi1 = qingjie1[i] +qingjie2[i] +qingjie3[i];
//            yiqi2 = (yiqi1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +yiqi1);
//            System.out.println(name[i] + "的平均分为:" +yiqi2);
//        }

//        double empty1 = 0, empty2 = 0;
//        double[] like = new double[30];
//        for (int i = 0; i < 30; i++) {
//            empty1 = qingjie1[i] + qingjie2[i] + qingjie3[i];
//            empty2 = (empty1 * 1.0) / 3;
//            like[i] = empty2;
//        }
//
//        for (int i = 0; i <like.length - 1; i++) {
//            for (int j = 0; j < like.length - i - 1; j++) {
//                if (like[j] < like[j + 1]) {
//                    double tep = like[j];
//                    like[j] = like[j + 1];
//                    like[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(like[i]);
//        }



        double bainian1 = 0,bainian2 = 0, bainian3 = 0;//计算每门课的平均分
        double shamo1 = 0,shamo2 = 0,shamo3 = 0;//计算每门课标准差
        double yinguo1 = 0,yinguo2 = 0,yinguo3 = 0;//计算每门课中位数
        double sap = 0;
        for (int i = 0; i < qingjie1.length; i++) {
            sap+=qingjie1[i];
        }
        bainian1 = (sap*1.0)/30;
        System.out.println("分析化学的班级平均分为:"+ bainian1);
        double Sum = 0;
        for (int i = 0; i < qingjie2.length; i++) {
            Sum+=qingjie2[i];
        }
        bainian2 = (Sum*1.0)/30;
        System.out.println("线性代数的班级平均分为:"+bainian2);
        double sum = 0;
        for (int i = 0; i <qingjie3.length; i++) {
            sum+=qingjie3[i];
        }
        bainian3 = (sum*1.0)/30;
        System.out.println("有机化学的班级平均分为:"+bainian3);




        double guji1 = 0,guji2 = 0,guji3 = 0;
        for (int i = 0; i <qingjie1.length; i++) {
            guji1+= (qingjie1[i] -bainian1)*(qingjie1[i] - bainian1);
        }
        shamo1 = Math.sqrt(guji1*1.0/30);
        System.out.println("分析化学的班级标准差为:"+shamo1);

        for (int i = 0; i <qingjie2.length; i++) {
            guji2+= (qingjie2[i] -bainian2)*(qingjie2[i] -bainian2);
        }
        shamo2 = Math.sqrt(guji2*1.0/30);
        System.out.println("线性代数的班级标准差为:"+shamo2);

        for (int i = 0; i <qingjie3.length; i++) {
            guji3+= (qingjie3[i] - bainian3)*(qingjie3[i] - bainian3);
        }
        shamo3 = Math.sqrt(guji3*1.0/30);
        System.out.println("有机化学的班级标准差为:"+shamo3);
////////
////////
////////
//        Arrays.sort(qingjie1);
//        Arrays.sort(qingjie2);
//        Arrays.sort(qingjie3);
//        yinguo1 =( qingjie1[14]+qingjie1[15])*1.0/2;
//        yinguo2 =(qingjie2[14]+qingjie2[15])*1.0/2;
//        yinguo3 =( qingjie3[14]+qingjie3[15])*1.0/2;
//        System.out.println("分析化学的中位数为:"+ yinguo1);
//        System.out.println("线性代数的中位数为:"+ yinguo2);
//        System.out.println("有机化学学的中位数为:"+ yinguo3);

    }
}
